package com.quectel.core.module.securitypatrol.dto;

import io.swagger.v3.oas.annotations.media.Schema;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;

import java.io.Serializable;
import java.util.Date;
import java.util.List;

/**
 * @author caolu
 * @email louis.cao@quectel.com
 * @date 2022/05/07 14:10
 */
@Data
@Schema
public class SecurityPatrolTaskDto implements Serializable {

    /**
     *
     */
    @Schema(description = "")
    private Long id;

    /**
     *
     */
    @Schema(description = "")
    private Long tenantId;

    /**
     * 所属小区
     */
    @Schema(description = "所属小区")
    private Long villageId;

    @Schema(description = "巡检种类1安防巡检2质量检查3环境保洁4绿化养护")
    private Byte category;

    /**
     * 计划id
     */
    @Schema(description = "计划id")
    private Long planId;

    /**
     * 任务名称(日期+计划+时间段)
     */
    @Schema(description = "任务名称(日期+计划+时间段)")
    private String name;

    /**
     * 巡检人id
     */
    @Schema(description = "巡检人id")
    private Long execUserId;

    /**
     * 巡检人姓名
     */
    @Schema(description = "巡检人姓名")
    private String execUsername;

    /**
     * 任务日期2020-10-03
     */
    @Schema(description = "任务日期2020-10-03")
    private String date;

    /**
     * 日期时间段03:00-06:00
     */
    @Schema(description = "日期时间段03:00-06:00")
    private String period;

    @Schema(description = "任务开始时间")
    private Date execStartTime;

    @Schema(description = "任务结束时间")
    private Date execEndTime;

    /**
     * 0生成未执行 1执行中  2执行成功
     */
    @Schema(description = "0生成未执行 1执行中  2执行成功")
    private Byte execStatus;

    /**
     * 已经执行巡检点位的数量
     */
    @Schema(description = "已经执行巡检点位的数量")
    private Integer execCount;

    /**
     * 巡检数量
     */
    @Schema(description = "巡检数量")
    private Integer routeCount;

    /**
     * 可以有多个[0,2]异常和跳检
     */
    @Schema(description = "可以有多个[0,2]异常和跳检")
    private String routeExecTotalStatus;

    /**
     * 是否推送1是0否
     */
    @Schema(description = "是否推送1是0否")
    private Byte isPush;

    @Schema(description = "完成时间")
    private Date completeTime;

    /**
     *
     */
    @Schema(description = "")
    private Date createTime;
    /************非数据库字段 start ************/

    @Schema(description = "所属小区名称")
    private String villageName;

    @Schema(description = "计划名称")
    private String planName;

    @Schema(description = "点位执行情况")
    private List<ExecInfo> execInfos;

    @Schema(description = "任务计划详情")
    private SecurityPatrolPlanDto securityPatrolPlanDto;


    @Schema(description = "点位上报详情")
    private List<SecurityPatrolEventReportDto> securityPatrolEventReportDtos;


    /************非数据库字段 end **************/
    @Schema(description = "上报人手机号")
    private String execUserMobile;


    /************ 内部类 start ************/
    @Data
    @Schema
    @AllArgsConstructor
    @NoArgsConstructor
    public static class ExecInfo implements Serializable {

        @Schema(description = "任务和点位关联表id")
        private Long taskRouteId;

        @Schema(description = "点位设备ID")
        private Long deviceId;

        @Schema(description = "点位设备名称")
        private String deviceName;

        @Schema(description = "执行状态 状态0异常1正常2跳检")
        private Byte status;

        @Schema(description = "创建时间")
        private Date createTime;

        @Schema(description = "完成时间")
        private Date completeTime;

        @Schema(description = "设备经度")
        private Double lng;

        @Schema(description = "设备纬度")
        private Double lat;

        @Schema(description = "设备地址")
        private String address;

        @Schema(description = "跳检原因")
        private Byte skipCheckReasonType;

        @Schema(description = "抓拍图片数据")
        private String snapshotImg;

        @Schema(description = "事件描述")
        private String detail;

        @Schema(description = "项目详情list")
        List<SecurityPatrolEventReportDto> reportList;

    }
    /************ 内部类 end ************/


}
